﻿using System;
using System.Collections.Generic;

namespace YJKArchUtils.Utils.Generics
{
	public class Comparint<T> : IEqualityComparer<T>
	{
		public Comparint()
		{
		}

		public Comparint(EqualsComparer<T> e)
		{
			this.ec = e;
		}

		public bool Equals(T x, T y)
		{
			return this.ec != null && this.ec(x, y);
		}

		public int GetHashCode(T obj)
		{
			return obj.ToString().GetHashCode();
		}

		private EqualsComparer<T> ec;
	}
}
